package cn.tedu.oopTestConstructor.cn.tedu;

import java.io.Serializable;

/**
 * @author SWJ
 * @create 2021-06-18 10:31
 * 本类用来封装学生类
 * <p>
 * Serializable是一个空接口里面没有方法
 * 实现这个接口是作为一个标志，标志本类可以被序列化
 */
public class Student2 implements Serializable {
    /**
     * 定义学生类的相关属性并且相关属性赋值进行封装
     */
    private String name;
    private int age;
    private String adder;
    private char gender;

    /**
     * 必须手动添加无参构造--因为一旦添加了无参构造默认含参照
     */
    public Student2() {
        System.out.println("无参构造");
    }

    public Student2(String name, int age, String adder, char gender) {
        super();
        System.out.println("设置的全参构造");
        this.name = name;
        this.age = age;
        this.adder = adder;
        this.gender = gender;
    }

    /**
     * 提供属性公共访问点
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAdder() {
        return adder;
    }

    public void setAdder(String adder) {
        this.adder = adder;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Student [name=" + name + ", age=" + age + ", addr=" + adder + ", gender=" + gender + "]";
    }

}
